<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>北京航天公司固定资产管理系统</title>
</head>
<body>

<div class="layui-inline">
    <div class="layui-col-xs6 layui-col-md4">
        <blockquote class="layui-elem-quote" style="width: 1550px;">资产领用详情</blockquote><br>
    </div>
</div>

    <div class="layui-btn-container" th:if="${session.userInfo.type}=='系统管理员'" style="display: inline;">
        <button class="layui-btn  layui-btn-danger" onclick="approval();" >审核拒绝</button>
        <button class="layui-btn"  onclick="approvals()" >审核通过</button>
        <input type="hidden" name="borrow_id" th:value="${claimVo.borrowNumber}">
        <input type="hidden" name="pass_id" th:value="1">
        <input type="hidden" name="turn_id" th:value="3">
    </div>
    <br>
    <br>
    <div class="layui-btn-container" th:if="${session.userInfo.type}=='普通员工'" style="visibility: hidden;">
        <button class="layui-btn  layui-btn-danger" onclick="approval();" >审核拒绝</button>
        <button class="layui-btn"  onclick="approvals()" >审核通过</button>
        <input type="hidden" name="borrow_id" th:value="${claimVo.borrowNumber}">
        <input type="hidden" name="pass_id" th:value="1">
        <input type="hidden" name="turn_id" th:value="3">

    </div>
<button class="layui-btn"  onclick="back()" >返回</button>

    <form action="javascript:void(0)" class="layui-form">

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">所属组织</label>
                <div class="layui-input-inline">
                    <input type="hidden" name="id" th:value="${claimVo.borrowNumber}">
                    <input type="tel" name="phone" readonly lay-verify="required|phone" th:value="${claimVo.homeDname}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">所属部门/门店</label>
                <div class="layui-input-inline">
                    <input type="text" name="email" readonly lay-verify="email" th:value="${claimVo.dname}" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">责任人</label>
                <div class="layui-input-inline">
                    <input type="tel" name="phone" readonly lay-verify="required|phone" th:value="${claimVo.admin}" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">申请领用时间</label>
                <div class="layui-input-inline">
                    <input type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" th:value="${claimVo.drawingTime}" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">领用单号</label>
                <div class="layui-input-inline">
                    <input type="text" name="borrowNumber" readonly lay-verify="email" th:value="${claimVo.borrowNumber}" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">申请说明</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" readonly th:value="${claimVo.purpose}" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-collapse" lay-filter="test">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">具体借用信息</h2>
                <div class="layui-colla-content">
                    <table class="layui-table" >
                        <thead>
                        <tr>
                            <th>资产编号</th>
                            <th>资产名称</th>
                            <th>资产负责人</th>
                            <th>资产所属部門</th>
                        </tr>
                        </thead>
                        <tboby>
                            <tr th:each="claim : ${claim}">
                                <td th:text="${claim.property_id}"></td>
                                <td th:text="${claim.property_name}"></td>
                                <td th:text="${claim.property_principal}"></td>
                                <td th:text="${claim.dname}"></td>
                            </tr>
                        </tboby>
                    </table>
                </div>
            </div>
        </div>
    </form>



</body>
<script type="text/javascript"  src="/js/jquery-1.8.2.js"></script>
<script type="text/javascript"  src="/js/layer.js"></script>
<script type="text/javascript"  src="/layui/layui.all.js" ></script>
<link rel="stylesheet" href="/layui/css/layui.css">
<style>
    header {
        background-color:#339966;
        color:white;
        text-align:center;
        padding:5px;
    }

    footer {
        background-color:#339966;
        color:white;
        clear:both;
        text-align:center;
        padding:5px;
    }
</style>
<script type="text/javascript">
    // // 拒绝
    approval=function() {
        var borrow_id = $("input[name='borrow_id']").val();
        var turn_id = $("input[name='turn_id']").val();
        $.post("/claim/saveByClaim?borrowNumber="+borrow_id+"&status="+turn_id,function (res) {
            if(res >0){
                alert("拒绝成功")
                location.href="/jump/goclaimIndex";
            }
        })
    }
    // 通过
    approvals=function() {
        var borrow_id = $("input[name='borrow_id']").val();
        var pass_id = $("input[name='pass_id']").val();
        $.post("/claim/saveByClaim?borrowNumber=" + borrow_id + "&status=" + pass_id, function (res) {
            if (res > 0) {
                alert("通过成功")
                location.href = "/jump/goclaimIndex";
            }
        })
    }
    function back(){
        window.location.href="/jump/goclaimIndex";
    }
</script>
</html>